import { request } from '@/api/service'

export const urlProPrefix = '/ai/projects/'
export const urlModelPrefix = '/ai/models/'
export const urlServicePrefix = '/ai/services/'

export function GetProList (query) {
  return request({
    url: urlProPrefix,
    method: 'get',
    params: { ...query }
  })
}

export function GetModelList (query) {
  return request({
    url: urlModelPrefix,
    method: 'get',
    params: { query }
  })
}

export function StopTrain (modelID) {
  return request({
    url: urlModelPrefix + 'stop/',
    method: 'get',
    params: { id: modelID }
  })
}

export function DelProObj (id) {
  return request({
    url: urlProPrefix + id + '/',
    method: 'delete',
    data: { soft_delete: true }
  })
}

export function DelModelObj (id) {
  return request({
    url: urlModelPrefix + id + '/',
    method: 'delete',
    data: { soft_delete: true }
  })
}

export function GetTrainStatus (modelID) {
  return request({
    url: urlModelPrefix + 'status/',
    method: 'get',
    params: { id: modelID }
  })
}

export function PublishService (obj) {
  return request({
    url: urlServicePrefix,
    method: 'post',
    data: obj
  })
}
